package practice05;

/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: practice01
 * @ClassName: Person
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/12/3 10:49
 * @Copyright 大牛版板所有
 */
public class Person {
    private String name;
    private int age;

    public Person(){

    }

    public Person(String name,int age){
        this.age = age;
        this.name = name;
    }

    public void display(){
        System.out.println(this.name+"的年龄为："+this.age+"岁");
    }

    public static void main(String[] args) {
        Person person1 = new Person();
        person1.name = "张三";
        person1.age = 20;
        System.out.println("无参构造方法显示：");
        person1.display();


        Person person2 = new Person("李四",18);
        System.out.println("有参构造方法显示：");
        person2.display();
    }
}
